
<template>
    <div class="container">
        <Navbars ></Navbars>
        <!-- 条件 -->
        <div class="querydiv" shadow="never">
            <el-form :inline="true" size="medium" label-width="70px"> 
                <el-form-item label="">
                    <el-input v-model="listQuery.name" placeholder="机构名称"></el-input>
                </el-form-item>
                <el-form-item label="">
                    <el-input v-model="listQuery.code" placeholder="机构编码"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button class="btn btncolor" type="primary" @click="getList">查询</el-button>
                    <el-button class="btn" @click="handleReset">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <!-- 表格 -->
        <div class="mt15">
            <el-card class="tab-card" shadow="never">
                <div slot="header" class="spacebetween disflex align-center">
                    <span style="color:#676a6f;font-size:14px">机构管理列表</span>
                    <!-- <el-button class="btn btncolor" icon="el-icon-plus" type="primary" @click="handleAdd">新增</el-button> -->
                </div>
                <el-table :data="tableData" :header-cell-style="{background:'#e4ebfd',color:'#7690db'}" :row-class-name="tableRowClassName">
                    <el-table-column align="center" prop="projectName"  label="项目名称" ></el-table-column>
                    <el-table-column align="center" prop="branchName" label="分支名称"></el-table-column>
                    <el-table-column align="center" prop="mergeName" label="提交合并人"></el-table-column>
                    <el-table-column align="center" prop="status" label="状态"></el-table-column>
                    <el-table-column align="center" prop="createTime" label="提交时间"></el-table-column>
                    <el-table-column align="center" fixed="right"  label="操作">
                        <template slot-scope="scope">
                            <el-button type="text"  class="edit" @click="handlInfo(scope.row)">详情</el-button>
                            <el-divider direction="vertical"></el-divider>
                            <el-button type="text" @click="handleBoh(scope.row)" class="del">驳回</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-card>
            <!--分页 -->
            <Pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.num"></Pagination>
        </div>
    </div>
</template>

<script>
import { mergepage } from '@/api/manager.js'
import Pagination from '@/components/Pagination'
export default {
    name: 'merge',
    components: { Pagination },
    data(){
        return{
            listLoading:false,
            listQuery:{
                page:1,
                num:10
            },
            tableData:[],
            total:0
        }
    },
    created(){
        this.getList()
    },
    methods:{
        // 设置表格颜色
        tableRowClassName({row, rowIndex}) {
            if (rowIndex%2==0) { return 'warning-row'}
            return '';
        },
        // 获取表格列表信息
        getList() {
            this.$getFlag().then(obj=>{
                    this.listLoading = false
                    mergepage(this.listQuery,obj.data).then(response => {
                    this.tableData = response.list
                    this.total = Number(response.total)
                    setTimeout(() => {
                        this.listLoading = false
                    }, 1.5 * 1000)
                })
            })
        },
        handlInfo(item){
            this.$router.push({
                path: '/mergeinfo',
                query:{id:item.id}
            })
        },
        handleBoh(){

        },
        handleReset(){

        }
    }
}
</script>